<?php
namespace app\v1\controller;

use support\Request;
use app\model\Util;
use app\model\GoodsModel;
use Exception;
use support\Db;
class SecondController {
    
    public function today(Request $request){
        $today = date('Y-m-d');
        $data = GoodsModel::where('second_day','=',$today)->limit(2)->get();
        foreach($data as $item){
            $item['image_url'] = Util::pathToUrl($item->image);
            $item['min_price'] = $item->minPrice();
        }
        
        return json([
            'code' => 1,
            'data' => $data,
        ]);
    }
} 